<!DOCTYPE html>
<?php $this->load->helper('url'); ?>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"  lang="sr-RS"> <!--<![endif]-->
    <head>

        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>HR application • Dynamint</title>
        <meta name="description" content="HR application">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel='shortcut icon' type='image/x-icon' href='/favicon.ico' />
        <!-- Styles -->
        <link rel="stylesheet" href="<?php echo base_url() ?>css/uikit.min.css">
        <link rel="stylesheet" href="<?php echo base_url() ?>css/main.css">
        <link rel="stylesheet" href="<?php echo base_url() ?>css/responsive.css">

        <script src="<?php echo base_url() ?>js/vendor/modernizr-2.6.2.min.js"></script>
    </head>
    <body>
        <!--[if lt IE 7]>
            <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
        <![endif]-->
        <!-- <div class="pristup">
            <div class="uk-badge">administrator</div><br/>
        </div> -->
        <div id="top">
            <div class="uk-container uk-container-center">
                
                <div class="uk-grid">
                    <div class="uk-width-1-4 logo">
                        <div class="uk-width-1-1 "><span>merit</span> plan</div>
                        <div class="uk-width-1-1 logosmall">upravljanje ljudskim resursima<br /> i organizacioni razvoj</div>
                    </div>
                    <div class="uk-width-2-4 uk-text-center"><h2>Spisak kompanija</h2><p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr</p></div>
                    <div class="uk-width-1-4">
                        <div class="uk-grid uk-text-right usertop">
                            <div class="uk-width-3-4"><?php echo $user[0]->first_name ?> <?php echo $user[0]->last_name ?>
                            <?php if ($user[0]->user_level==0): ?>
                                <div class="useruloga">
                                    <div class="uk-badge">nov user</div>
                                </div>
                                <?php endif; ?>
                                <?php if ($user[0]->user_level==1): ?>
                                <div class="useruloga">
                                    <div class="uk-badge uk-badge-success">korisnik</div>
                                </div>
                                <?php endif; ?>
                                <?php if ($user[0]->user_level==2): ?>
                                <div class="useruloga">
                                    <div class="uk-badge uk-badge-warnning">supervizor</div>
                                </div>
                                <?php endif; ?>
                                 <?php if ($user[0]->user_level==3): ?>
                                <div class="useruloga">
                                    <div class="uk-badge">administrator</div>
                                </div>
                                <?php endif; ?>
                            </div>
                            <div class="uk-width-1-4 uk-text-center"><span class="uk-icon-user"></span></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!--<div id="menu">
            <div class="uk-container uk-container-center">
                <nav class="uk-navbar">
                    <ul class="uk-navbar-nav">
                <?php if ($user[0]->user_level>=2): ?>
                    <li class="uk-active"><a href="<?php echo base_url() ?>humanresources/kompanije" class="uk-navbar-nav-subtitle">Kompanije<div>i sektori</div></a></li>
                <?php endif; ?>    
                    <li data-uk-dropdown><a href="<?php echo base_url() ?>humanresources/profil_korisnika" class="uk-navbar-nav-subtitle">Profil<div>korisnika</div></a>
                <?php if ($user[0]->user_level>=1): ?>    
                        <div class="uk-dropdown">
                            <ul class="uk-nav uk-nav-dropdown">
                                <li><a href="<?php echo base_url() ?>humanresources/izmeni_profil" class="">Izmeni Profil</a></li>
                            </ul>
                        </div>
                <?php endif; ?>        
                    </li>
                <?php if ($user[0]->user_level>=1): ?>    
                    <li data-uk-dropdown><a href="<?php echo base_url() ?>humanresources/opis_posla" class="uk-navbar-nav-subtitle">Opis posla<div>upitnik</div></a>
                        <div class="uk-dropdown">
                            <ul class="uk-nav uk-nav-dropdown">
                                <li><a href="<?php echo base_url() ?>humanresources/primeri" class="">Primeri</a></li>
                            </ul>
                        </div>
                    </li>
                    <li><a href="<?php echo base_url() ?>humanresources/finalna_verzija" class="uk-navbar-nav-subtitle">Opis Posla<div>verzija 1</div></a></li>
                    <li><a href="<?php echo base_url() ?>humanresources/finalna_verzija_nova" class="uk-navbar-nav-subtitle">Opis Posla<div>verzija 2</div></a></li><?php endif; ?>  
                
                <?php if ($user[0]->user_level>=2): ?>     
                    <li  data-uk-dropdown><a href="<?php echo base_url() ?>humanresources/spisak_korisnika" class="uk-navbar-nav-subtitle">Lista korisnika<div></div></a>
                        <div class="uk-dropdown">
                            <ul class="uk-nav uk-nav-dropdown">
                                <li><a href="<?php echo base_url() ?>humanresources/spisak_korisnika" class="">Lista korisnika</a></li>
                                <li><a href="<?php echo base_url() ?>humanresources/dodaj_korisnika" class="">Dodaj korisnika</a></li>
                            </ul>
                        </div>
                    </li>
                <?php endif; ?>    
                    
                </ul>
                <div class="uk-navbar-flip">
                    <ul class="uk-navbar-nav">
                        <li><a href="<?php echo base_url() ?>humanresources/userLogout">Logout</a></li>
                    </ul>
                </div>
                </nav>
            </div>
        </div>-->
        <?php echo $menu ?>
        <div id="main">
            <div class="uk-container uk-container-center">
                <div class="uk-grid">
                    <div class="uk-width-1-1">
                        <div class="uk-grid">
                            <div class="uk-width-1-1 uk-text-center">
                                <div class="uk-alert" data-uk-alert>
                                    <a href="" class="uk-alert-close uk-close"></a>
                                    <p>Ovu stranu vide samo administratori</p>
                                </div>
                            </div>
                        </div>
                        <div class="uk-grid">
                            <div class="uk-width-1-2">
                                    
                                    
                                    
                                <div class="uk-panel uk-panel-box uk-panel-box-secondary">
                                    <h3 class="uk-panel-title"><i class="uk-icon-cog"></i> Kompanije</h3>
                                    <ul class="kompanije uk-list uk-list-striped uk-width-1-1">
                                     
                                    <?php foreach ($companies as $company): ?>
                                        <li class="uk-width-1-1">
                                            <span class="uk-float-left uk-width-2-3">
                                                <span  class="uk-width-1-2 uk-float-left"><?php echo $company->company_name;  ?></span> 
                                                <span class="sektori uk-width-1-2 uk-float-right">Sektori <i class="uk-icon-chevron-circle-down"></i></span>

                                            </span>
                                            <span class="uk-float-right uk-text-right uk-width-1-3">
                                                <span class="uk-float-left uk-text-right">
                                                    <form method="post"  action="<?php echo base_url(); ?>humanresources/deleteCompany">
                                                        <input type="hidden" name="id" value="<?php echo $company->id;  ?>">
                                                        <button class="uk-button uk-button-danger uk-float-left"  type="submit" >obriši</button>&nbsp;
                                                    </form>
                                                </span>
                                                <span class="uk-float-left uk-text-left">                                                    
                                                    <a href ="<?php echo base_url(); ?>humanresources/organogram/<?php echo $company->id; ?>"><div class="uk-button uk-button-primary uk-float-left">organogram</div></a>
                                                </span>
                                                
                                            </span>
                                            <div class="uk-clearfix"></div>
                                            <ul class="sektor uk-list  uk-width-1-1">
                                            <?php
                                            $query = $this->db->where('company_id', $company->id)->get('sectors');                                            
                                            $sectors = $query->result();                                           

                                                foreach ($sectors as $sector):?> 

                                                    <li>
                                                        <span class="uk-float-left uk-width-1-1 uk-text-right">
                                                            <span class="sektornull uk-width-1-2 uk-float-left uk-text-left"><?php  echo $sector->sector_name;  ?></span>                                                           
                                                            <a href="<?php echo base_url(); ?>humanresources/deleteSektorColumns/<?php echo $sector->id ?>">obrisi</a> | 
                                                            <a href="<?php echo base_url(); ?>humanresources/organogramSector/<?php echo $sector->id; ?>">organogram</a>
                                                            </span>
                                                        <div class="uk-clearfix"></div>
                                                    </li>
                                                
     
                                            <?php endforeach;  ?>
                                            </ul>
                                        </li>
                                        
                                    <?php endforeach;  ?>   
                                    </ul>
                                    
                                </div>
                            </div>
                            
                            <div class="uk-width-1-2">
                                <?php if ($user[0]->user_level==3): ?>
                                <div class="uk-panel uk-panel-box uk-panel-box-secondary">
                                    <h3 class="uk-panel-title"><i class="uk-icon-cog"></i> Dodaj kompaniju</h3>
                                    <form class="uk-form uk-width-1-1" method="post" action="<?php echo base_url(); ?>humanresources/addCompany">

                                        <fieldset>
                                            <div class="uk-form-row">
                                                <input type="text" placeholder="Naziv kompanije" name="company_name">
                                            </div>
                                            <div class="uk-form-row">
                                                <button class="uk-button uk-button-primary" type="submit">Dodaj</button>
                                            </div>
                                        </fieldset>

                                    </form>
                                </div>
                                <?php endif; ?>
                                <?php if ($user[0]->user_level>=2): ?>
                                <div class="uk-panel uk-panel-box uk-panel-box-secondary">
                                    <h3 class="uk-panel-title"><i class="uk-icon-cog"></i> Dodaj Sektor</h3>
                                    <form class="uk-form uk-width-1-1" method="post" action="<?php echo base_url(); ?>humanresources/addSektorColumns">

                                        <fieldset>
                                            <div class="uk-form-row">
                                                <select name="id" id="firma">
                                                    <option>Izaberite firmu</option>
                                                    <?php foreach ($companies as $company): ?>
                                                    <option id="<?php echo $company->id;  ?>" value="<?php echo $company->id;  ?>"><?php echo 
                                                    $company->company_name;  ?></option>
                                                    <?php endforeach;  ?>  
                                                </select>
                                            </div>
                                            
                                            
                                            <?php foreach ($companies as $company): ?>
                                            <?php    $id = $company->id;  ?>
                                            <div class="uk-form-row dodaj-sektor" style="display:none" id="<?php echo  $company->company_name;  ?>">Naziv Sektora</p>
                                             <input type="text" name="sektor_name"> 
                                            </div>
                                            <?php endforeach;  ?>
                                         
                                            <div class="uk-form-row">
                                                <button class="uk-button uk-button-primary">Dodaj</button>
                                            </div>
                                        </fieldset>

                                    </form>
                                </div>
                                <?php endif; ?>
                            </div>
                        </div> <!-- iner grid -->
                        <div class="uk-grid">
                            <div class="uk-width-1-1">
                                <div class="uk-panel uk-panel-box uk-panel-box-primary"><p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.. At vero eos et accusam et justo duo dolores et ea rebum. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et</p></div>
                                
                            </div>
                        </div>
                    </div> <!-- main 3 4 -->
                </div> <!-- grid -->    
            </div> <!-- container -->
        </div>    
        <div id="futer">
            <div class="uk-container uk-container-center uk-text-center">
 Merit Plan &copy; 2013 
            </div>
        </div>
        <!-- Scripts -->
        <script src="<?php echo base_url() ?>js/vendor/jquery-1.10.2.min.js"></script>
        <script src="<?php echo base_url() ?>js/vendor/uikit.min.js"></script>
        <script src="<?php echo base_url() ?>js/plugins.js"></script>
        <script src="<?php echo base_url() ?>js/main.js"></script>
        <script type="text/javascript">
            
            $( "#firma" ).change(function() {
                firma = $('#firma').find(":selected").text();
                $('.dodaj-sektor').each(function(index, el) {
                    sektor = $(this).attr('id');
                    if (sektor == firma) {
                        $(this).css('display', 'block');
                        $(this).find('input').removeAttr('disabled');
                    } else{
                        $(this).css('display', 'none');
                        $(this).find('input').attr('disabled','disabled');
                    };
                });
            });
            $('.sektor li').each(function(index, el) {
                if ($(this).find('.sektornull').text() == 'NULL') {
                    $(this).remove();
                };
            });
            
            
        </script>

        <!-- Google Analytics -->

    </body>
</html>
